package com.project.poetry.service.controller;

import com.project.poetry.service.entity.dto.code.CodeDTO;
import com.project.poetry.service.service.CodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 字典控制器
 * @author mengxj
 */
@Api("code字典")
@RequestMapping("code")
@RestController
public class CodeController {

    @Resource
    private CodeService codeService;

    @ApiOperation("通过type获取字典信息")
    @GetMapping("getCodesByType")
    public List<CodeDTO> getCodesByType(@RequestParam("type") Integer type){
        return this.codeService.getCodesByType(type);
    }
}
